/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bo;

import dbmapper.StoryMapper;
import dbmapper.UserMapper;
import java.sql.SQLException;
import java.util.ArrayList;
import javabean.StoryBean;

/**
 *
 * @author Admin
 */
public class StoryBO {
    StoryBean stbean=new StoryBean();
    public ArrayList<StoryBean> LayDanhSachTruyen() throws ClassNotFoundException, SQLException {
        ArrayList<StoryBean> ds = new ArrayList<StoryBean>();
        StoryMapper stMapper = new StoryMapper();            
            
        try {
            ds = stMapper.LayDanhSachTruyen();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            stMapper.con.close();
        }

        return ds;
    }
    
    public ArrayList<StoryBean> LayDanhSachTruyenTheoTL(String theloai) throws ClassNotFoundException, SQLException {
        ArrayList<StoryBean> ds = new ArrayList<StoryBean>();
        StoryMapper stMapper = new StoryMapper();            
            
        try {
            ds = stMapper.LayTruyenTheoTheLoai(theloai);
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            stMapper.con.close();
        }

        return ds;
    }
    
        public ArrayList<StoryBean> LayDanhSachTruyenTheoTen(String tentruyen) throws ClassNotFoundException, SQLException {
        ArrayList<StoryBean> ds = new ArrayList<StoryBean>();
        StoryMapper stMapper = new StoryMapper();            
            
        try {
            ds = stMapper.LayTruyenTheoTen(tentruyen);
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            stMapper.con.close();
        }

        return ds;
    }
}
